package com.huawei.mpchartdemo1;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button pieChart;
    private Button barChart;
    private Button scatterChart;
    private Button lineChart;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        lineChart.setOnClickListener(this);
        scatterChart.setOnClickListener(this);
        barChart.setOnClickListener(this);
        pieChart.setOnClickListener(this);
    }

    private void initView() {
        pieChart = (Button) findViewById(R.id.pieChart);
        barChart = (Button) findViewById(R.id.barChart);
        scatterChart = (Button) findViewById(R.id.scatterChart);
        lineChart = (Button) findViewById(R.id.lineChart);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.lineChart:
                startActivity(new Intent(MainActivity.this, LineChartActivity.class));
                break;
            case R.id.barChart:
                startActivity(new Intent(MainActivity.this, BarChartActivity.class));
                break;
            case R.id.scatterChart:
                startActivity(new Intent(MainActivity.this, ScatterChartActivity.class));
                break;
            case R.id.pieChart:
                startActivity(new Intent(MainActivity.this, PieChartActivity.class));
                break;
        }
    }
}